<?php

namespace App\Models;

use Illuminate\Support\Facades\DB;

class Tags extends Model
{
    protected $table = 'tags';

    /**
     * @param $id
     * @return mixed
     * @name 通过id获取一条信息
     * @author Deann.wu
     */
    public static function getInfoById($id){
         return DB::table('tags')->where('id',$id)->first();
    }

    /**
     * @param $name
     * @author Deann.wu
     * @name 通过name获取一条信息
     */
    public static function getInfoByName($name){
        return DB::table('tags')->where('name',$name)->first();
    }

    /**
     * @return mixed
     * @author Deann.wu
     * @name 获取数据
     */
    public static function getListData(){
        return  DB::table('tags')->orderBy('is_recommend','desc')->orderBy('id','desc')->paginate(15);
    }

    /**
     * @return mixed
     * @author Deann.wu
     * @name 获取所有数据
     */
    public static function getListDataAll(){
        return  DB::table('tags')->orderBy('id','desc')->get();
    }
}
